from multiprocessing import Process, Array
import mpmath
#def solve(lbda,gamma,mu,delta,Ns,Pm,lock):
def solve(lbda,gamma,mu,delta,Ns,Pm):
	mpmath.mp.dps=120
	a=lbda/delta
	b=a+gamma/delta
	c=mu/delta
	G1=mpmath.gamma(b)
	G2=mpmath.gamma(a)
	sol=len(Ns)*[1]
	for i,m in enumerate(Ns):
		G3=mpmath.gamma(a+m)
		G4=mpmath.gamma(b+m)
		G5=mpmath.gamma(m+1)
		E=mpmath.power(c,m)
		F1=mpmath.hyp1f1(a+m,b+m,-c)
		S=(G1/G2)*(G3/G4)/G5*(E*F1)
		sol[i]=S
	#lock.acquire()
	for i,m in enumerate(Ns):
		Pm[m]=sol[i]
	#lock.release()
	return

if __name__=="__main__":
	import sys
	NPROC=2
	#lock = Lock()
	lbda=float(sys.argv[1])
	gamma=float(sys.argv[2])
	mu=float(sys.argv[3])
	delta=float(sys.argv[4])
	N=int(sys.argv[5])
	Pm=Array('d', N+1)
	p=[]
	for i in range(NPROC):
		Ns=range(i,N+1,NPROC)
		#p.append(Process(target=solve, args=(lbda,gamma,mu,delta,Ns,Pm,lock)))
		p.append(Process(target=solve, args=(lbda,gamma,mu,delta,Ns,Pm)))
		p[i].start()
	for i in range(NPROC):
		p[i].join()
	for x in (Pm[:]):
		print(x)
